<template>
	<div>
		<!-- xpert导航栏 -->
		<xpertNavBar :statusTab="statusTab" />
		<div style="height: 150px; width: 100%" class=""></div>
		<!-- Notifications -->
		<div class="verify">Verify</div>
		<div v-if="id == 2" style="margin-top: 70px; margin-bottom: 70px">
			<ResulsComp :num="num" />
		</div>
		<!-- whyVerify -->
		<div v-if="id != 2" class="whyVerify">
			<div class="tit">Why Verify?</div>
			<div class="boxItem f f-a-c f-j-b">
				<div class="boxLe">
					<div class="num">1</div>
					<div class="count">At Xpert, we foster an authentic environment. Verification will establish trust between you and potential buyers.</div>
				</div>
				<div class="boxLe">
					<div class="num">2</div>
					<div class="count">Once you become verified, your visibility will substantially increase, leading to greater exposure!</div>
				</div>
				<div class="boxLe">
					<div class="num">3</div>
					<div class="count">Verified experts enjoy access to additional features, which in turn leads to a substantial increase in orders.</div>
				</div>
			</div>
		</div>
		<!-- form -->
		<div class="form">
			<div class="account">My account</div>
			<!-- 表单============================================================================ -->
			<div class="formFrom">
				<div class="nameForm m-b-30 f f-a-c f-j-b">
					<div class="lefName">
						<div class="name f f-a-c">First name <span>*</span></div>
						<input type="text" class="inps" v-model="form.firstName" placeholder="" name="" id="" />
					</div>
					<div class="lefName">
						<div class="name f f-a-c">Last name <span>*</span></div>
						<input type="text" class="inps" v-model="form.lastName" placeholder="" name="" id="" />
					</div>
				</div>
				<!-- 姓名 -->
				<div class="nameForm m-b-30 f f-a-c f-j-b">
					<div class="lefName">
						<div class="name f f-a-c">Username <span>*</span> <img style="width: 14px; height: 14px; margin-left: 10px" src="/src/assets/user/wen.png" alt="" /></div>
						<input type="text" class="inps" v-model="form.userName" placeholder="" name="" id="" />
					</div>
					<div class="lefName">
						<div class="name f f-a-c">Date of Birth <span>*</span><img style="width: 14px; height: 14px; margin-left: 10px" src="/src/assets/user/wen.png" alt="" /></div>
						<input type="text" class="inps" v-model="form.dateOfBirth" placeholder="DD/MM/YYYY" name="" id="" />
					</div>
				</div>
				<!-- 性别 -->
				<div class="nameForm m-b-30 f f-a-c f-j-b">
					<div class="lefName">
						<div class="name f f-a-c">Gender <span>*</span><img style="width: 14px; height: 14px; margin-left: 10px" src="/src/assets/user/wen.png" alt="" /></div>
						<!-- <input type="text" class="inps" v-model="form.userName" placeholder="" name="" id="" /> -->
						<el-select v-model="form.gender" placeholder="Select option" size="large" style="width: 100%">
							<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
						</el-select>
					</div>
					<div class="lefName">
						<div class="name f f-a-c">Language <span>*</span><img style="width: 14px; height: 14px; margin-left: 10px" src="/src/assets/user/wen.png" alt="" /></div>
						<!-- <input type="text" class="inps" v-model="form.dateOfBirth" placeholder="MM/DD/YY" name="" id="" /> -->
						<!-- <el-select v-model="form.language" placeholder="Select option" size="large" style="width: 100%">
								<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
							</el-select> -->
						<el-select v-model="form.language" size="large" multiple placeholder="Select option" style="width: 100%">
							<el-option v-for="item in langList" :key="item.value" :label="item.label" :value="item.value" />
						</el-select>
					</div>
				</div>
				<!-- 邮箱 -->
				<div class="nameForm m-b-30 f f-a-c f-j-b">
					<div class="lefName">
						<div class="name f f-a-c">Email <span>*</span></div>
						<input type="text" class="inps" v-model="form.email" placeholder="" name="" id="" />
					</div>
					<div class="lefName">
						<div class="name f f-a-c">Phone number <span>*</span></div>
						<input type="text" class="inps" v-model="form.phoneNumber" placeholder="" name="" id="" />
					</div>
				</div>
				<!-- 地址-->
				<div class="nameForms m-b-30 f f-j-b">
					<div class="lefName">
						<div class="name f f-a-c">Location <span>*</span></div>
						<el-select @change="changeOne" v-model="form.country" placeholder="Country" size="large" style="width: 100%">
							<el-option v-for="item in addOne" :key="item.value" :label="item.label" :value="item.value" />
						</el-select>
					</div>
					<div class="lefName">
						<!-- <div class="name f f-a-c"></div> -->
						<el-select v-model="form.state" @change="changeTow" placeholder="State" size="large" style="width: 100%">
							<el-option v-for="item in addTow" :key="item.value" :label="item.label" :value="item.value" />
						</el-select>
					</div>
					<div class="lefName">
						<!-- <div class="name f f-a-c"></div> -->
						<el-select v-model="form.city" placeholder="City" size="large" style="width: 100%">
							<el-option v-for="item in addStree" :key="item.value" :label="item.label" :value="item.value" />
						</el-select>
					</div>
				</div>
				<!-- Sector -->
				<div class="nameForm m-b-30 f f-a-c f-j-b">
					<div class="lefName">
						<div class="name f f-a-c">Sector <span>*</span></div>
						<!-- <input type="text" class="inps" v-model="form.userName" placeholder="" name="" id="" /> -->
						<el-select v-model="form.sector" @change="chasngeSector" placeholder="Select option" size="large" style="width: 100%">
							<el-option v-for="item in sector" :key="item.value" :label="item.label" :value="item.value" />
						</el-select>
					</div>
					<div class="lefName">
						<div class="name f f-a-c">Industry <span>*</span></div>
						<!-- <input type="text" class="inps" v-model="form.dateOfBirth" placeholder="MM/DD/YY" name="" id="" /> -->
						<el-select v-model="form.industry" placeholder="Select option" size="large" style="width: 100%">
							<el-option v-for="item in industry" :key="item.value" :label="item.label" :value="item.value" />
						</el-select>
					</div>
				</div>
				<!-- title -->
				<div class="nameForm m-b-30 f f-a-c f-j-b">
					<div style="width: 100%" class="lefName">
						<div class="name f f-a-c">Title <span>*</span></div>
						<input type="text" class="inps" v-model="form.title" placeholder="" name="" id="" />
					</div>
				</div>
				<!-- Say something about yourself  -->
				<div class="nameForm m-b-30 f f-a-c f-j-b">
					<div style="width: 100%" class="lefName">
						<div class="name f f-a-c">Say something about yourself <span>*</span></div>
						<a-textarea v-model:value="form.count" class="textarea" placeholder="Introduce yourself with 15 characters minimum." :auto-size="{ minRows: 2, maxRows: 5 }" />
					</div>
				</div>
				<!-- topic -->
				<div style="margin-top: 30px" class="nameForm m-b-30 f f-a-c f-j-b">
					<div style="width: 100%" class="lefName">
						<div class="name f f-a-c">Topic<span>*</span></div>
						<el-select @change="changTop" v-model="form.topic" size="large" multiple placeholder="" style="width: 100%">
							<el-option v-for="item in topicsList" :key="item.value" :label="item.label" :value="item.value" />
						</el-select>
					</div>
				</div>
				<!-- 表示为2是卖家显示出来 -->
				<div>
					<!-- 下面的加减 -->
					<div class="work">
						<div class="workTit f f-a-c f-j-b">
							<div class="name f f-a-c">Work experience <span>*</span></div>
							<div @click="clickJia" class="rigwork hand">+</div>
						</div>
						<!-- Work experience  -->
						<div v-for="(item, index) in form.workList" style="margin-bottom: 20px" :key="index">
							<div class="workInp f f-a-c f-j-b">
								<div class="inpBox">
									<input type="text" v-model="item.company" class="inps" placeholder="Company" name="" id="" />
								</div>
								<div class="inpBox">
									<input type="text" v-model="item.position" class="inps" placeholder="Position" name="" id="" />
								</div>
								<div class="inpBox">
									<input type="text" v-model="item.time" class="inps" placeholder="Time" name="" id="" />
								</div>
								<div class="inpBox">
									<input type="text" v-model="item.location" class="inps" placeholder="Location" name="" id="" />
								</div>
								<div @click="clickX(item, index)" class="x hand">x</div>
							</div>
							<!-- Upload a file or link  -->
							<div @click="daKai(item, index, 1)" class="link hand f f-a-c">
								<img src="/src/assets/user/link.png" class="linkImg" alt="" />
								<div class="linkCon">{{ item.fileLink || "Upload a file or link" }}</div>
							</div>
						</div>
					</div>
					<!-- 下面的加减 -->
					<div class="work m-t-30">
						<div class="workTit f f-a-c f-j-b">
							<div class="name f f-a-c">Education experience <span>*</span><img style="width: 14px; height: 14px; margin-left: 10px" src="/src/assets/user/wen.png" alt="" /></div>
							<div @click="clickJiaWork" class="rigwork hand">+</div>
						</div>
						<!-- Work experience  -->
						<div v-for="(item, index) in form.educationList" style="margin-bottom: 20px" :key="index">
							<div class="workInp f f-a-c f-j-b">
								<div class="inpBoxs">
									<input type="text" class="inps" v-model="item.school" placeholder="School" name="" id="" />
								</div>
								<div class="inpBoxs">
									<input type="text" class="inps" v-model="item.degree" placeholder="Degree" name="" id="" />
								</div>
								<div class="inpBoxs">
									<input type="text" class="inps" v-model="item.fieldOfStudy" placeholder="Field of study" name="" id="" />
								</div>

								<div @click="clickXWork(item, index)" class="x hand">x</div>
							</div>
							<!-- Upload a file or link  -->
							<div @click="daKai(item, index, 2)" v-if="ind == 2 || ind == 5" class="link hand f f-a-c">
								<img src="/src/assets/user/link.png" class="linkImg" alt="" />
								<div class="linkCon">{{ item.fileLink || "Upload a file or link" }}</div>
							</div>
						</div>
					</div>
				</div>
				<!-- 下面的上传 -->
				<div class="work" style="margin-top: 40px">
					<div class="workTit f f-a-c f-j-b">
						<div class="name f f-a-c">Certificate <img class="hand" style="width: 14px; height: 14px; margin-left: 10px" src="/src/assets/user/wen.png" alt="" /></div>
					</div>
					<div>
						<div class="upLoad">
							<el-upload
								v-model:file-list="form.fileList"
								action="http://172.16.1.68:40080/xpert-api/common/file/upload"
								list-type="picture-card"
								:on-preview="handlePictureCardPreview"
								:on-progress="progress"
								:on-success="success"
								:headers="uploadHeaders"
								multiple
								:on-remove="handleRemove">
								<el-icon><Plus /></el-icon>
							</el-upload>
						</div>
					</div>
				</div>
				<div class="p-b-30 btn f f-a-c">
					<div @click="saveBtn" class="submit hand">Submit</div>
				</div>
			</div>
		</div>
		<!-- faq -->
		<div class="faq">
			<div class="faqTop">FAQ</div>
			<div class="faqBody">
				<div v-for="(item, index) in list" @click="goDetils(item)" :key="index" class="faqItem hand f f-a-c f-j-b p-l-10 p-r-10">
					<div class="countNei">{{ item.title }}</div>
					<img src="/src/assets/user/2.png" class="img" alt="" />
				</div>

				<div @click="router.push('/BlogFAQ')" class="more hand">More</div>
			</div>
		</div>
		<el-dialog v-model="upLoadVisible" title="" width="40%">
			<div class="titleUl">Upload</div>
			<div class="sectl f f-a-c">
				<div @click="upFile = !upFile" class="left f f-a-c">
					<img src="/src/assets/user/gou.png" v-if="upFile" alt="" />
					<img src="/src/assets/user/weigou.png" v-else alt="" />
					File
				</div>
				<div @click="upFile = !upFile" class="left f f-a-c">
					<img src="/src/assets/user/gou.png" v-if="!upFile" alt="" />
					<img src="/src/assets/user/weigou.png" v-else alt="" />
					Link
				</div>
			</div>
			<!-- 上传文件 -->
			<div v-if="upFile" class="fileDiv">
				<el-upload
					v-model:file-list="upLinkList"
					class="upload-demo"
					:on-success="onSuccess"
					:headers="uploadHeaders"
					action="http://172.16.1.68:40080/xpert-api/common/file/upload"
					:limit="1"
					multiple>
					<el-button type="primary">Click to upload</el-button>
					<!-- <template #tip>
						<div class="el-upload__tip">jpg/png files with a size less than 500KB.</div>
					</template> -->
				</el-upload>
			</div>
			<!-- 上传链接 -->
			<div v-else class="fileDiv">
				<div class="upLoad">Link address</div>
				<input type="text" class="filDoingInp" v-model="likAddress" name="" id="" />
			</div>
			<div class="btnSumit f f-a-c">
				<div @click="comfig" class="sumIit">Submit</div>
			</div>
		</el-dialog>
		<button></button>
		<xpertTabbar />
	</div>
</template>

<script setup>
	import { ref, onMounted, reactive } from "vue";
	import { AddressList, ClassificationTree, TopicsList, SettingList } from "@/api/commonality.js";
	import { UpDataVerify, BuyerUpdatesUserDetails, CreateVerify, BuyUserinfo, FaqsList, BuyerUserDetils, SellerUserDetails } from "@/api/xpert.js";
	import { CreateVerifys, UpDataVerifys, FaqsLists } from "@/api/knowClub/index.js";
	import { Plus } from "@element-plus/icons-vue";
	import { useRoute } from "vue-router";
	import { ElMessage } from "element-plus";
	import xpertTabbar from "@/components/tabBar/xpertTabbar.vue";
	import xpertNavBar from "@/components/navBar/xpertNavBar.vue";
	import ResulsComp from "./resulsComp.vue";
	import router from "@/router/index.js";
	import ButtonDiffuse from "@/components/Button/ButtonDiffuse.vue";
	let numInde = localStorage.getItem("home") || 1;
	let ind = localStorage.getItem("ind") || 1;
	let token = null;
	let num = ref(0);
	if (numInde == 1) {
		// 代表是xpert首页
		token = "Bearer " + localStorage.getItem("xpToken") || "";
	} else {
		// 代表是knowClub首页
		token = "Bearer " + localStorage.getItem("kcToken") || "";
	}
	let statusTab = ref(1);

	const indLink = ref("");
	const numInd = ref(0);
	const indsLinkUp = ref("");
	const upFile = ref(true);
	const total = ref(0);
	const likAddress = ref("");
	const upLoadVisible = ref(false);
	const avaList = ref([]);
	const upLinkList = ref([]);
	const avaImg = ref("/src/assets/tou.png");
	const value = ref("");
	const name = ref("");
	const list = ref([]);
	const addOne = ref([]);
	const pageNum = ref(1);
	const id = ref(0);
	const addTow = ref([]);
	const addStree = ref([]);
	const sector = ref([]);
	const industry = ref([]);
	const topicsList = ref([]);
	const langList = ref([]);
	const fileList = ref([]);
	let route = useRoute();
	if (route.query.act == 2) {
		const uploadHeaders = ref({
			"Authorization-Kc": token
		});
	} else {
		const uploadHeaders = ref({
			"Authorization-Xp": token
		});
	}
	// 获取路由传过来的参数id==2时显示步骤条隐藏上方说明

	const options = [
		{
			value: 1,
			label: "male"
		},
		{
			value: 2,
			label: "female"
		},
		{
			value: 3,
			label: "rather not say"
		}
	];
	onMounted(async () => {
		if (route.query.id) {
			id.value = route.query.id;
		}
		if (route.query.num) {
			num.value = route.query.num;
		}
		if (route.query.act == 1) {
			// 获取FAQ
			await faqList();
			// 获取国家
			await addressListOne();
			// 获取分类树
			await classFen();
			// 获取语言
			await languageList();
			// 获取topics
			await topics();
			// 获取详情
			await initObjHui();
		} else {
			await faqLists();
			// 获取国家
			await addressListOne();
			// 获取分类树
			await classFen();
			// 获取语言
			await languageList();
			// 获取topics
			await topics();
			await initObjHuiss();
		}
		window.addEventListener("scroll", handleScroll);
	});
	let form = reactive({
		firstName: "",
		lastName: "",
		userName: "",
		dateOfBirth: "",
		gender: "",
		language: [],
		email: "",
		phoneNumber: "",
		city: "",
		state: "",
		country: "",
		count: "",
		industry: "",
		sector: "",
		title: "",
		topic: [],
		fileList: [],
		workList: [
			{
				company: "",
				position: "",
				time: "",
				location: "",
				fileLink: ""
			}
		],
		educationList: [
			{
				school: "",
				degree: "",
				fieldOfStudy: "",
				fileLink: ""
			}
		]
	});
	// 会哦去FAQ
	const faqList = async () => {
		let n = await FaqsList({
			pageNum: pageNum.value
		});
		total.value = n.data.total;
		list.value = [...list.value, ...n.data.list];
	};
	// 会哦去FAQ
	const faqLists = async () => {
		let n = await FaqsLists({
			pageNum: pageNum.value
		});
		total.value = n.data.total;
		list.value = [...list.value, ...n.data.list];
	};
	// 请求第一个国家地址
	const addressListOne = async () => {
		addStree.value = [];
		addTow.value = [];
		let n = await AddressList({ par: "GL" });
		addOne.value = n.data;
		addOne.value.forEach(item => {
			item.value = item.code;
			item.label = item.name;
		});
	};
	// 获取分一级类树
	const classFen = async () => {
		industry.value = [];
		let n = await ClassificationTree();
		sector.value = n.data;
		sector.value.forEach(item => {
			item.value = item.id;
			item.children.forEach(ite => {
				ite.value = ite.id;
			});
		});
	};
	// 点击跳转faq
	const goDetils = item => {
		router.push({ path: "/Detail", query: { id: item.id } });
	};
	// 获取语言
	const languageList = async () => {
		let n = await SettingList({
			title: "language"
		});
		langList.value = n.data;
		langList.value.forEach(item => {
			item.label = item.value;
		});
	};
	// 获取topics列表
	const topics = async () => {
		let n = await TopicsList();
		topicsList.value = n.data;
		topicsList.value.forEach(item => {
			item.value = item.id;
			item.label = item.name;
		});
	};
	//这个是回显数据
	const initObjHui = async () => {
		if (ind == 2) {
			// 表示卖家
			let n = await SellerUserDetails();
			// debugger;
			console.log(n, "99999999999999999999999999999999999");
			if (n.data) {
				if (n.data.countryCode) {
					// 表示有国家，要去请求 州
					let m = addOne.value.filter(item => item.code == n.data.countryCode);

					changeOne(m[0].code);
					form.state = n.data.stateCode;
					form.city = n.data.cityCode;
				}
				if (n.data.sectorId) {
					chasngeSector(n.data.sectorId);
					// 表示工作
					form.sector = n.data.sectorId;
					form.industry = n.data.industry;
				}
				avaImg.value = n.data.avatar; //头像
				form.gender = n.data.sex;
				form.firstName = n.data.firstName;
				form.userName = n.data.username;
				form.lastName = n.data.lastName;
				form.dateOfBirth = n.data.birth;
				form.language = n.data.language;
				form.phoneNumber = n.data.mobile;
				form.country = n.data.countryCode; //国家
				form.email = n.data.email;
				form.city = n.data.areaCode;
				form.industry = n.data.industry;
				form.topic = n.data.topicIds;
				form.title = n.data.title;
				form.count = n.data.myDescribe;
				form.workList = n.data.workExperience || [
					{
						company: "",
						position: "",
						time: "",
						location: "",
						fileLink: ""
					}
				];
				form.educationList = n.data.educationExperience || [
					{
						school: "",
						degree: "",
						fieldOfStudy: "",
						fileLink: ""
					}
				];
				fileList.value = n.data.certificateImages || [];
				form.fileList = n.data.certificateImages.map((item, index) => {
					return {
						name: index,
						url: item
					};
				});
			}
		} else {
			// 表示买家
			let n = await BuyerUserDetils();
			if (n.data) {
				if (n.data.countryCode) {
					// 表示有国家，要去请求 州
					let m = addOne.value.filter(item => item.code == n.data.countryCode);
					changeOne(m[0].code);
					form.state = n.data.stateCode;
					form.city = n.data.cityCode;
				}
				if (n.data.sectorId) {
					chasngeSector(n.data.sectorId);
					// 表示工作
					form.sector = n.data.sectorId;
					form.industry = n.data.industry;
				}
				avaImg.value = n.data.avatar; //头像
				form.gender = n.data.sex;
				form.firstName = n.data.firstName;
				form.userName = n.data.username;
				form.lastName = n.data.lastName;
				form.dateOfBirth = n.data.birth;
				form.language = n.data.language;
				form.phoneNumber = n.data.mobile;
				form.country = n.data.countryCode; //国家
				form.email = n.data.email;
				form.city = n.data.areaCode;
				form.industry = n.data.industry;
				form.topic = n.data.topicIds;
				form.title = n.data.title;
				form.count = n.data.myDescribe;
				form.workList = n.data.workExperience || [
					{
						company: "",
						position: "",
						time: "",
						location: "",
						fileLink: ""
					}
				];
				form.educationList = n.data.educationExperience || [
					{
						school: "",
						degree: "",
						fieldOfStudy: "",
						fileLink: ""
					}
				];
				// fileList.value = n.data.certificateImages || [];
			}
		}
	};
	//这个是回显数据
	const initObjHuiss = async () => {
		if (ind == 2 || ind == 5) {
			// 表示卖家
			let n = null;
			if (ind == 5) {
				n = await CreateVerifys();
			} else {
				n = await CreateVerify();
			}
			// debugger;
			if (n.data) {
				n.data.sectorId = n.data.industryOne;
				n.data.industry = n.data.industryTwo;
				if (n.data.countryCode) {
					// 表示有国家，要去请求 州
					let m = addOne.value.filter(item => item.code == n.data.countryCode);

					changeOne(m[0].code);
					form.state = n.data.stateCode;
					form.city = n.data.cityCode;
				}
				if (n.data.sectorId) {
					chasngeSector(n.data.sectorId);
					// 表示工作
					form.sector = n.data.sectorId;
					form.industry = n.data.industry;
				}
				avaImg.value = n.data.avatar; //头像
				form.gender = n.data.sex;
				form.firstName = n.data.firstName;
				form.userName = n.data.username;
				form.lastName = n.data.lastName;
				form.dateOfBirth = n.data.birth;
				form.language = n.data.language;
				form.phoneNumber = n.data.mobile;
				form.country = n.data.countryCode; //国家
				form.email = n.data.email;
				form.city = n.data.areaCode;
				form.industry = n.data.industry;
				form.topic = n.data.topicIds;
				form.title = n.data.title;
				form.count = n.data.myDescribe;
				form.workList = n.data.workExperience || [
					{
						company: "",
						position: "",
						time: "",
						location: "",
						fileLink: ""
					}
				];
				form.educationList = n.data.educationExperience || [
					{
						school: "",
						degree: "",
						fieldOfStudy: "",
						fileLink: ""
					}
				];
				fileList.value = n.data.certificateImages || [];
				form.fileList = n.data.certificateImages.map((item, index) => {
					return {
						name: index,
						url: item
					};
				});
			}
		} else {
			console.log("666666666666666666666666666666666666666666666666666666666666666");
			// 表示买家
			let n = null;
			if (ind == 5) {
				n = await CreateVerifys();
			} else {
				n = await CreateVerify();
			}
			if (n.data) {
				if (n.data.countryCode) {
					// 表示有国家，要去请求 州
					let m = addOne.value.filter(item => item.code == n.data.countryCode);
					changeOne(m[0].code);
					form.state = n.data.stateCode;
					form.city = n.data.cityCode;
				}
				if (n.data.sectorId) {
					chasngeSector(n.data.sectorId);
					// 表示工作
					form.sector = n.data.sectorId;
					form.industry = n.data.industry;
				}
				avaImg.value = n.data.avatar; //头像
				form.gender = n.data.sex;
				form.firstName = n.data.firstName;
				form.userName = n.data.username;
				form.lastName = n.data.lastName;
				form.dateOfBirth = n.data.birth;
				form.language = n.data.language;
				form.phoneNumber = n.data.mobile;
				form.country = n.data.countryCode; //国家
				form.email = n.data.email;
				form.city = n.data.areaCode;
				form.industry = n.data.industry;
				form.topic = n.data.topicIds;
				form.title = n.data.title;
				form.count = n.data.myDescribe;
				form.workList = n.data.workExperience || [
					{
						company: "",
						position: "",
						time: "",
						location: "",
						fileLink: ""
					}
				];
				form.educationList = n.data.educationExperience || [
					{
						school: "",
						degree: "",
						fieldOfStudy: "",
						fileLink: ""
					}
				];
				// fileList.value = n.data.certificateImages || [];
			}
		}
	};
	// 点击save
	const saveBtn = async () => {
		if (route.query.act == 2) {
			// 代表kc卖家
			if (ind == 2 || ind == 5) {
				let obj = {
					firstName: form.firstName,
					lastName: form.lastName,
					username: form.userName,
					birth: form.dateOfBirth,
					sex: form.gender,
					language: form.language,
					email: form.email,
					mobile: form.phoneNumber,
					avatar: avaImg.value,
					areaCode: form.city,
					areaDetails: "", //详细地址
					industryOne: form.sector,
					industryTwo: form.industry, //行业
					topicIds: form.topic,
					title: form.title,
					myDescribe: form.count,
					mark: "",
					workExperience: form.workList,
					educationExperience: form.educationList,
					certificateImages: fileList.value
				};
				// 表示卖家
				let n = null;
				if (ind == 5) {
					n = await UpDataVerifys(obj);
				} else {
					n = await UpDataVerify(obj);
				}
				if (n.code == 200) {
					ElMessage.success(n.msg);
				}
				if (id.value == 2) {
					router.go(-1);
				}
			} else {
				// 表示买家
				let obj = {
					firstName: form.firstName,
					lastName: form.lastName,
					username: form.userName,
					birth: form.dateOfBirth,
					sex: form.gender,
					language: form.language,
					email: form.email,
					mobile: form.phoneNumber,
					avatar: avaImg.value,
					areaCode: form.city,
					areaDetails: "", //详细地址
					industryOne: form.sector,
					industryTwo: form.industry, //行业
					topicIds: form.topic,
					title: form.title,
					myDescribe: form.count,
					mark: "",
					workExperience: form.workList,
					educationExperience: form.educationList
					// certificateImages: fileList.value
				};
				let n = null;
				if (ind == 5) {
					n = await UpDataVerifys(obj);
				} else {
					n = await UpDataVerify(obj);
				}
				if (n.code == 200) {
					ElMessage.success(n.msg);
				}
				if (id.value == 2) {
					router.go(-1);
				}
			}
		} else {
			//代表xp卖家
			if (ind == 2 || ind == 5) {
				// 表示卖家
				let obj = {
					firstName: form.firstName,
					lastName: form.lastName,
					username: form.userName,
					birth: form.dateOfBirth,
					sex: form.gender,
					language: form.language,
					email: form.email,
					mobile: form.phoneNumber,
					avatar: avaImg.value,
					areaCode: form.city,
					areaDetails: "", //详细地址
					industry: form.industry, //行业
					topicIds: form.topic,
					title: form.title,
					myDescribe: form.count,
					mark: "",
					workExperience: form.workList,
					educationExperience: form.educationList,
					certificateImages: fileList.value
				};
				let n = null;
				if (ind == 5) {
					n = await UpDataVerifys(obj);
				} else {
					n = await UpDataVerify(obj);
				}
				if (n.code == 200) {
					ElMessage.success(n.msg);
				}
				if (id.value == 2) {
					router.go(-1);
				}
			} else {
				let obj = {
					firstName: form.firstName,
					lastName: form.lastName,
					username: form.userName,
					birth: form.dateOfBirth,
					sex: form.gender,
					language: form.language,
					email: form.email,
					mobile: form.phoneNumber,
					avatar: avaImg.value,
					areaCode: form.city,
					areaDetails: "", //详细地址
					industry: form.industry, //行业
					industry: form.industry, //行业
					topicIds: form.topic,
					title: form.title,
					myDescribe: form.count,
					mark: "",
					workExperience: form.workList,
					educationExperience: form.educationList
					// certificateImages: fileList.value
				};
				let n = null;
				if (ind == 5) {
					n = await UpDataVerifys(obj);
				} else {
					n = await UpDataVerify(obj);
				}
				// 表示买家
				if (n.code == 200) {
					ElMessage.success(n.msg);
				}
				if (id.value == 2) {
					router.go(-1);
				}
			}
		}
	};
	// const changLang = () => {
	// };

	// const changTop = e => {
	// };

	// 分类树二级选择
	const chasngeSector = e => {
		form.industry = "";
		let list = sector.value.filter(item => item.id == e);
		industry.value = list[0].children;
	};

	// 请求第二个国家地址
	const addressListTow = async () => {
		addStree.value = [];
		let n = await AddressList({ par: name.value });
		addTow.value = n.data;
		addTow.value.forEach(item => {
			item.value = item.code;
			item.label = item.name;
		});
		if (form.state) {
			// 表示回显
			name.value = form.state;
			addressListStree();
		}
	};
	// 请求第三个国家地址
	const addressListStree = async () => {
		let n = await AddressList({ par: name.value });
		addStree.value = n.data;
		addStree.value.forEach(item => {
			item.value = item.code;
			item.label = item.name;
		});
	};
	// 选择城市后第一个
	const changeOne = e => {
		form.state = "";
		form.city = "";
		name.value = e;
		addressListTow();
	};
	// 第二个选择后
	const changeTow = e => {
		form.city = "";
		name.value = e;
		addressListStree();
	};
	// 点击差删除
	const clickX = (item, index) => {
		form.workList = form.workList.filter((item, ind) => index != ind);
	};
	// 点击加
	const clickJia = () => {
		form.workList.push({
			company: "",
			position: "",
			time: "",
			location: "",
			fileLink: ""
		});
	};
	// 点击差删除
	const clickXWork = (item, index) => {
		form.educationList = form.educationList.filter((item, ind) => index != ind);
	};
	// 点击加
	const clickJiaWork = () => {
		form.educationList.push({
			school: "",
			degree: "",
			fieldOfStudy: "",
			fileLink: ""
		});
	};
	// 点击确认
	const comfig = () => {
		if (numInd.value == 1) {
			// 表示第一个工作上传
			if (upFile.value) {
				// 表示上传文件
				form.workList[indLink.value].fileLink = indsLinkUp.value;
			} else {
				// 表示上传链接
				form.workList[indLink.value].fileLink = likAddress.value;
			}
		} else {
			// 表示第一个工作上传
			if (upFile.value) {
				// 表示上传文件
				form.educationList[indLink.value].fileLink = indsLinkUp.value;
			} else {
				// 表示上传链接
				form.educationList[indLink.value].fileLink = likAddress.value;
			}
		}
		upLoadVisible.value = false;
	};
	// 上传成功时的钩子
	const onSuccess = (e, obj) => {
		indsLinkUp.value = e.data;
	};
	// 上传成功时的钩子
	const successImg = (e, s) => {
		avaImg.value = e.data;
		console.log("上传成功", avaImg.value, "111111111111111111111111111111");
	};
	// 点击链接打开上传
	const daKai = (item, index, num) => {
		numInd.value = num;
		indLink.value = index;
		upLoadVisible.value = true;
		upLinkList.value = [];
		likAddress.value = "";
		indsLinkUp.value = "";
	};
	// 上传成功时的钩子
	const success = (e, s) => {
		fileList.value.push(e.data);
		console.log("上传成功", fileList.value, e.data, "89898989989");
	};
	// 点击文件列表中已上传的文件时的钩子
	// const handlePictureCardPreview = (e, s) => {};
	// 移除时的钩子
	const handleRemove = (e, s) => {
		fileList.value = fileList.value.filter(item => item != e.response.data);
		// console.log(e, s, fileList.value, "898989899989");
	};
	// 上传时的钩子
	// const progress = (e, s) => {};
	// 上传成功时的钩子
	// 这个是当头部导航栏滑倒下面时给tabr加个背景
	const handleScroll = () => {
		const scrollTop = document.documentElement.scrollTop;
		if (scrollTop > 0) {
			statusTab.value = 2;
		} else {
			statusTab.value = 1;
		}
	};
</script>
<style scoped>
	@import "./index.scss";
</style>
